import React from 'react'
import { SearchBar } from 'antd-mobile';
import './Drug.css'
import ZhmComp from '../../components/zhmComp/zhmComp'
import axios from 'axios'
class Drug extends React.Component {
    constructor() {
        super()
        this.state = {
            value: '',
            TableData: []//请求数据
        }
    }
    /* 页面打开，发起请求 */
    componentDidMount() {
        this.xuanran()
    }
    xuanran = () => {
        axios({
            url: 'api2/olife/client/queryShopList',
            method: 'get',
            data: {
                count: '',
                currentPage: '',
                object: '',
                pageSize: '',
                sort_type_name: '送药'
            }
        }).then(data => {
            console.log(data)
            this.setState({
                TableData: data.data.dataList
            })
            console.log(this.state.TableData)

        }).catch(err => {
            console.log(err);
        })
    }
    onChange = (value) => {
        this.setState({ value });
    };
    submit = () => {
        console.log('1111')
    }

    render() {
        return (
            <div id='Drug'>
                <div className='title1'>
                    <span className='iconfont icon-fanhuijian1 span1'></span>
                    <span className='span2'>送药</span>
                </div>
                <div>
                    <SearchBar
                        value={this.state.value}
                        placeholder="Search"
                        showCancelButton
                        onChange={this.onChange}
                        onSubmit={this.submit}
                    />
                </div>
                <ZhmComp tableData={this.state.TableData}></ZhmComp>
            </div>
        )
    }
}

export default Drug